/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package finder.filters;

import java.util.List;
import finder.ISecondaryFilter;

/**
 *
 * @author Alex
 */
public class FileTypeFilter implements ISecondaryFilter
{
    private String extension;
    public FileTypeFilter(String fileExtension)
    {
        extension = "." + fileExtension.replaceAll("\\W", "").toLowerCase();
    }
    @Override
    public void applyFilter(List<String> input) 
    {
        for(int x = 0; x < input.size();)
        {
            String value = input.get(x);
            if(!value.toLowerCase().endsWith(extension))
                input.remove(x);
            else
                x++;
        }
    }
}
